#include <chrono>
#include <string>
#include <unordered_map>
using namespace std;

struct TimeTrace {
  unordered_map<string, double> code_block_;
  unordered_map<string, _CHRONO time_point<_CHRONO system_clock>>
      code_block_point_;
  void begin_tick(string curr_block) {
    tick1_ = std::chrono::system_clock::now();
    ;

    // if (code_block_.find(curr_block) != code_block_.end()) {
    //
    //      /// do nothing
    // }
    // else {
    //
    //     code_block_[curr_block] = 0;
    // }

    code_block_point_[curr_block] = tick1_;
  }
  void end_tick(string curr_block) {
    auto tick2 = std::chrono::system_clock::now();
    std::chrono::duration<double> elapsed_seconds =
        tick2 - code_block_point_[curr_block];  // need to do  ,
    code_block_[curr_block] = code_block_[curr_block] + elapsed_seconds.count();
  }
  bool begin_ = false;
  bool end_ = true;
  _CHRONO time_point<_CHRONO system_clock> tick1_;
  // int tick2_ = 0;
};
